package org.xukai.common.spel;

import java.util.HashMap;
import java.util.Map;

/**
 * 
 * @author JackyLIU
 *
 */
public class FieldConfigMapBuilder {

	private final Map<String, FieldConfig<?>> fieldConfigs;
	
	public FieldConfigMapBuilder(){
		this.fieldConfigs = new HashMap<String, FieldConfig<?>>();
	}
	
	public FieldConfigMapBuilder(Map<String, FieldConfig<?>> fieldConfigs){
		this.fieldConfigs = fieldConfigs;
	}

	public Map<String, FieldConfig<?>> getFieldConfigs() {
		return fieldConfigs;
	}
	
	public void addFieldConfig(FieldConfig<?> fieldConfig){
		if(null == fieldConfig.getKey())
			throw new NullPointerException("miss property of key");
		
		fieldConfigs.put(fieldConfig.getKey(), fieldConfig);
	}
}
